import request from "@/utils/request";
import type { TradeMark } from "./type";

//品牌管理模块
enum API {
    TRADEMARK_URL = "/admin/product/baseTrademark/", //获取品牌列表
    ADDTRADEMARK_URL = "/admin/product/baseTrademark/save", //添加品牌
    UPDATETRADEMARK_URL = "/admin/product/baseTrademark/update", //修改品牌
    DELETETRADEMARK_URL = "/admin/product/baseTrademark/remove", //删除品牌
}

//获取品牌列表
// page页码
// limit 分页数
export const reqTradeMarkList = (_page: number, _limit: number) => {
    return request.get<any, TradeMark>(API.TRADEMARK_URL);
}

// 添加修改品牌
export const reqAddOrChangeTradeMark = (id: number) => {
    if (id) {
        return request.post<any, TradeMark>(API.UPDATETRADEMARK_URL, { id: id });
    } else {
        return request.get<any, TradeMark>(API.ADDTRADEMARK_URL);
    }

}